package com.recruit.controller;


import com.recruit.common.util.PageUtil;
import com.recruit.model.HonorRoll;
import com.recruit.service.IHonorRollService;
import com.recruit.vo.PageResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jikun
 * @since 2024-04-16
 */
@RestController
@RequestMapping("/honor-roll")
public class HonorRollController {
    @Autowired
    private IHonorRollService honorRollService;

    @GetMapping("/list")
    public PageResponseVO<HonorRoll> getHonorRolls(@RequestParam(name = "count", required = false, defaultValue = "15")
          @Min(value = 1, message = "{page.count.min}")
          @Max(value = 30, message = "{page.count.max}") Integer count,
          @RequestParam(name = "page", required = false, defaultValue = "0")
          @Min(value = 0, message = "{page.number.min}") Integer page) {
        return PageUtil.build(honorRollService.getHonorPage(page, count));

    }
}
